/* 
 * @description: 背景组件
 * @author: Jane 
 * @date: 2023-09-13 17:16:14
 */
import 'package:basic_common/common_exports.dart';
import 'package:flutter/material.dart';

/// 渐变圆角背景框
/// child 子组件
Widget gradientBgContainer({required Widget child}) {
  return Container(
    width: ScreenHelper.screenWidth,
    constraints: BoxConstraints(minHeight: ScreenHelper.height(120)),
    alignment: Alignment.center,
    decoration: const BoxDecoration(
      shape: BoxShape.rectangle,
      borderRadius: BorderRadius.all(Radius.circular(10)),
      // 线性渐变，分别设置渐变的颜色，起始点
      gradient: LinearGradient(
          begin: Alignment.centerLeft,
          end: Alignment.centerRight,
          colors: [Color(0xFF12C287), Color(0xFF14DB98)]),
    ),
    child: child,
  );
}

/// 纯色圆角背景
/// bgColor 背景颜色
Widget solidConnerContainer(
    {required Widget child,
    required Color? bgColor,
    double width = 0,
    double height = 0,
    EdgeInsetsGeometry? margin,
    EdgeInsetsGeometry? padding}) {
  return Container(
    width: width == 0 ? ScreenHelper.screenWidth / 2 : width,
    height: height == 0 ? ScreenHelper.height(80) : height,
    padding: padding,
    alignment: Alignment.center,
    margin: margin,
    decoration: BoxDecoration(
      color: bgColor!,
      borderRadius: const BorderRadius.all(Radius.circular(10)),
    ),
    child: child,
  );
}